package com.pubinfo.passbook.data.controller.bill;


import com.pubinfo.passbook.common.entity.TPassbookRegular;
import com.pubinfo.passbook.common.mapper.TPassbookRegularMapper;
import com.pubinfo.passbook.common.model.vo.base.JsonResult;
import com.pubinfo.passbook.common.service.master.TPassbookRegularService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xuhong
 * @since 2022-04-06
 */
@RestController
@RequestMapping("/regular")
@Api(tags = "不纳入报销的项目管理")
public class TPassbookRegularController {

    @Autowired
    TPassbookRegularService tPassbookRegularService;

    @Autowired
    TPassbookRegularMapper tPassbookRegularMapper;

    @PostMapping("/addRegula")
    @ApiOperation(value = "添加不纳入报销的项目")
    public JsonResult<Boolean> addRegula(@RequestBody TPassbookRegular tPassbookRegular){
        return JsonResult.success(tPassbookRegularService.save(tPassbookRegular));
    }

    @PostMapping("/regulaList")
    @ApiOperation(value = "不纳入报销的项目列表")
    public JsonResult<List<TPassbookRegular>> regulaList(){
        return JsonResult.success(tPassbookRegularService.list());
    }

    @PostMapping("/updateRegula")
    @ApiOperation(value = "修改项目状态")
    public JsonResult<Boolean> updateRegula(@RequestBody String id){
        return JsonResult.success(tPassbookRegularMapper.updateRegula(id));
    }

}

